package com.xinfu.newproject.adapter.home_provider;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.xinfu.newproject.R;
import com.xinfu.newproject.adapter.home_adapter.HomeThreeAdapter;
import com.xinfu.newproject.bean.home.bean.GetAppIconBean;
import com.xinfu.newproject.entity.NormalMultipleEntity;

/**
 * https://github.com/chaychan
 * @author ChayChan
 * @description: Text Img ItemProvider
 * @date 2018/3/30  11:39
 */
public class TextImgItemProvider extends BaseItemProvider<NormalMultipleEntity, BaseViewHolder> {

    private RecyclerView recyclerView;
    private HomeThreeAdapter homeThreeAdapter;
    private GetAppIconBean.ResultBean intelligentDeviceBean;

    public TextImgItemProvider(GetAppIconBean.ResultBean intelligentDeviceBean) {
        this.intelligentDeviceBean = intelligentDeviceBean;
    }
    @Override
    public int viewType() {
        return HomeMultipleItemRvAdapter.TYPE_TEXT_IMG;
    }

    @Override
    public int layout() {
        return R.layout.item_img_text_view;
    }

    @Override
    public void convert(BaseViewHolder helper, NormalMultipleEntity data, int position) {
        recyclerView = helper.getView(R.id.item_home_recycler);
        homeThreeAdapter = new HomeThreeAdapter();
        recyclerView.setLayoutManager(new GridLayoutManager(mContext,4));
        recyclerView.setAdapter(homeThreeAdapter);
        if (intelligentDeviceBean != null) {
            homeThreeAdapter.setNewData(intelligentDeviceBean.getIntelligentDevice());
        }
    }


}
